package top.yangbuyi;


import lombok.extern.slf4j.Slf4j;
import org.apache.dubbo.config.spring.context.annotation.EnableDubbo;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.core.env.Environment;

import java.net.InetAddress;
import java.net.UnknownHostException;

/**
 * @description: 杨不易网站:www.yangbuyi.top
 * @program: yangbuyiopenHis2020
 * @ClassName: SytemApplication
 * @create: 2020-08-26 23:26
 * @author: yangbuyi
 * @since： JDK1.8
 * @SytemApplication:
 **/

@SpringBootApplication
@Slf4j
@MapperScan(basePackages = {"top.yangbuyi.mapper"})
@EnableDubbo
public class SystemApplication {
	  public static void main(String[] args) throws UnknownHostException {
			ConfigurableApplicationContext application = SpringApplication.run(SystemApplication.class, args);
			Environment env = application.getEnvironment();
			String ip = InetAddress.getLocalHost().getHostAddress();
			String port = env.getProperty("server.port");
			String path = env.getProperty("server.servlet.context-path");
			String serverName = env.getProperty("spring.application.name");
			String active = env.getProperty("spring.profiles.active");
			String fileExtension = env.getProperty("spring.cloud.nacos.config.file-extension");
			log.info("\n" +
					" ____  ____   ______     ____  ____            ____  ____     _____      ______              ______    ____  ____    ______    _________   ________   ____    ____  \n" +
					"|_  _||_  _| |_   _ \\   |_  _||_  _|          |_   ||   _|   |_   _|   .' ____ \\           .' ____ \\  |_  _||_  _| .' ____ \\  |  _   _  | |_   __  | |_   \\  /   _| \n" +
					"  \\ \\  / /     | |_) |    \\ \\  / /    ______    | |__| |       | |     | (___ \\_|  ______  | (___ \\_|   \\ \\  / /   | (___ \\_| |_/ | | \\_|   | |_ \\_|   |   \\/   |   \n" +
					"   \\ \\/ /      |  __'.     \\ \\/ /    |______|   |  __  |       | |      _.____`.  |______|  _.____`.     \\ \\/ /     _.____`.      | |       |  _| _    | |\\  /| |   \n" +
					"   _|  |_     _| |__) |    _|  |_              _| |  | |_     _| |_    | \\____) |          | \\____) |    _|  |_    | \\____) |    _| |_     _| |__/ |  _| |_\\/_| |_  \n" +
					"  |______|   |_______/    |______|            |____||____|   |_____|    \\______.'           \\______.'   |______|    \\______.'   |_____|   |________| |_____||_____| \n" +
					"                                                                                                                                                                    ");
			log.info("\n\t---------------------------------------------------------------------\n\t" +
					"|                    欢迎使用主系统模块             \t\t\t\t\t" + "|\n\t" +
					"|Application yangbuyi-his is running! Access URLs:\t\t\t\t\t" + "|\n\t" +
					"|访问URL: \t\thttp://localhost:" + port + path + "/\t\t\t\t\t\t\t" + "|\n\t" +
					"|当前配置环境: \t\t当前环境为:" + active + "\t\t\t\t\t\t\t\t\t" + "|\n\t" +
					"|配置文件名称: \t\t" + serverName + "-" + active + "." + fileExtension + "\t\t\t\t\t\t\t\t\t|\n\t" +
					"---------------------------------------------------------------------");

	  }



}
